<?php

namespace App\Models\Scenic;

use App\Facades\SnowFlakeFacade;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Builder;

/**
 * @property string      $scenic_id      系统景点id
 */
class ScenicSpotProvider extends Model
{

    /**
     * 注册供应商景点
     * @param $provider
     * @param string $providerScenicId
     * @return ScenicSpotProvider
     */
    public function registerProviderScenic($provider,string $providerScenicId) :ScenicSpotProvider
    {
        $spotProviderModel = new ScenicSpotProvider();
        $spotProviderModel->scenic_id = SnowFlakeFacade::id();
        $spotProviderModel->provider = $provider;
        $spotProviderModel->provider_scenic_id = $providerScenicId;
        $spotProviderModel->created_at = time();
        $spotProviderModel->updated_at = time();
        $spotProviderModel->save();
        return $spotProviderModel;
    }

}
